home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 22
/
Amiga Format AFCD22 (Jan 1998, Issue 106).iso
/
-readerstuff-
/
d_keletsekis
/
tools
/
fastread
/
fread.gc
< prev
next >
Wrap
Text File
|
1997-10-03
|
6KB
|
283 lines
G4C
WINBIG 22 11 631 221 "FastRead"
wintype 11010001
; usetopaz
varpath ""
xonload
if $*FRGUIDE > ' '
guide = $*FRGUIDE
delvar *FRGUIDE
else
guiquit fread.gc
stop
endif
ifexists file guis:c/writenode
run 'resident guis:c/writenode pure add'
elseifexists file c:writenode
run 'resident c:writenode pure add'
else
ezreq 'FastRead:\nI need the WriteNode and\nGetNodes binaries..' OK ''
guiquit fread.gc
endif
xline = 0
gosub fread.gc loadguide
xonclose
guiclose fread.gc
delete ram:fr_list
delete ram:guide.txt
guiquit FRead.gc
guiquit fread.pop
guiquit fread.search
xonrmb
if $mode = text
lvuse fread.gc 1
lvchange ram:fr_list
lvmove #$xline
setwintitle FRead.gc 'INDEX : $guidename '
mode = index
else
guiopen fread.pop
endif
; ---------------------- the listview
XLISTVIEW 0 16 629 204 '' topic '' 10 txt
gadid 1
gadfont topaz.font 8 000
if $mode = index
xline = $$lv.line ; current line number
cutvar topic cut word -2 offset
extract topic unquote topic
cli 'writenode $guide $offset'
lvuse fread.gc 1
lvchange ram:guide.txt
setwintitle fread.gc '$guidename : $topic '
mode = text
endif
; ---------- routine to load a guide
; $guide = full path of guide or '' for requester
xROUTINE LOADGUIDE
if $guide > ' '
;
else
ReqFile -1 -1 300 200 'Choose a guide:' LOAD guide ''
if $guide <= ' '
stop
endif
endif
extract guide file list
guidename = $list
appvar list .idx
joinfile guis:tools/FastRead/idx $list list
ifexists file $list
;nop
else
cli 'getnodes $guide $list'
endif
mode = index
copy $list ram:fr_list
lvuse FRead.gc 1
lvchange ram:fr_list
guiopen FRead.gc
setwintitle FRead.gc 'INDEX : $guidename '
; ---------------------------- the graphic buttons
; display
BOX 1 1 153 15 out button
TEXT 15 1 60 15 '' 60 NOBOX
gadid 2
; Open
XBUTTON 163 1 33 15 "f"
gadfont gc.font 12 000
guide = ''
gosub fread.gc loadguide
update fread.gc 2 INDEX
; Quit
XBUTTON 197 1 33 15 "b"
gadfont gc.font 12 000
guiquit fread.gc
; save
XBUTTON 231 1 33 15 "F"
gadfont gc.font 12 000
; 1st
XBUTTON 273 1 33 15 "h"
gadfont gc.font 12 000
; Previous
XBUTTON 307 1 33 15 "G"
gadfont gc.font 12 000
; Next
XBUTTON 341 1 33 15 "g"
gadfont gc.font 12 000
; last
XBUTTON 375 1 33 15 "h"
gadfont gc.font 12 000
; find
XBUTTON 417 1 33 15 "u"
gadfont gc.font 12 000
; replace
XBUTTON 451 1 33 15 "U"
gadfont gc.font 12 000
; Cut
XBUTTON 489 1 33 15 "m"
gadfont gc.font 12 000
; Copy
XBUTTON 523 1 33 15 "M"
gadfont gc.font 12 000
; Paste
XBUTTON 557 1 33 15 "4"
gadfont gc.font 12 000
; Edit
XBUTTON 596 1 33 15 "N"
gadfont gc.font 12 000
;#########################################################################
; POP-UP ON RMB - while in index mode
;#########################################################################
NEWFILE fread.pop ; Pop-up on double-click "More.." gui.
WinBig 0 0 80 75 ""
WinType 00001000
winonmouse 30 7
varpath fread.gc
xOnRMB
guiclose FRead.pop
xOnInactive
guiclose FRead.pop
xOnFail
ezreq "Error during operation" OK ""
;---------------> the Buttons
xbutton 0 0 0 15 Open..
guiclose FRead.pop
guide = ''
gosub fread.gc loadguide
setgad fread.pop 10 on
xbutton 0 15 0 15 Search
guiclose FRead.pop
guiopen fread.search
xbutton 0 30 0 15 ReIndex
guiclose FRead.pop
ifexists file $list
delete $list
endif
cli 'getnodes $guide $list'
mode = index
copy $list ram:fr_list
lvuse FRead.gc 1
lvchange ram:fr_list
setgad fread.pop 10 on
setwintitle FRead.gc 'RE-INDEXED : $guidename '
xbutton 0 45 0 15 " Sort "
gadid 5
guiclose FRead.pop
gadid 10
if $mode = index
lvuse fread.gc 1
linetxt = $$lv.rec
lvsort asc
lvfind $linetxt
lvsave ram:fr_list
xline = $$lv.line
setgad fread.pop 10 off
endif
xbutton 0 60 0 15 Quit
guiclose FRead.pop
guiquit fread.gc
;#########################################################################
; SEARCH GUI
;#########################################################################
NEWFILE fread.search
winbig -1 -1 300 32 'Enter Search string :'
wintype 11110001
varpath 'fread.gc/fread.pop'
xonopen ; reset variables on opening
srchmode = CI
flag = 0
xTextIn 0 0 0 15 '' str '' 128
gosub FRead.search search
xCycler 0 17 150 14 '' srchmode ; choose case sensitive/insen..
cstr 'Ignore case' CI
cstr 'Same case' CS
xButton 150 17 100 14 'Top' ; go to top of lv
flag = 0
lvgo #0
update FRead.gc 1 0
setwintitle FRead.search 'Enter search string :'
xButton 250 17 50 14 >>
gosub FRead.search search
xroutine search
if $str = '' ; no string entered
stop
endif
lvuse FRead.gc 1 ; use the reader's listview
if $flag = 0 ; flag=0 means this is the first time
flag = 1
lvsearch $str $srchmode first ; Keywords such as mode (CI or CS), do
; not get translated, but in lvsearch
; it's an exception, so we can say $mode
else
lvsearch $str $srchmode next
endif
if $$lv.line > '' ; update to line found
update FRead.gc 1 $$lv.line
setwintitle FRead.search 'Line $$lv.line'
else
lvgo #0 ; or else go top again
flag = 0
setwintitle FRead.search 'Search Finished'
endif